@layout("/common/_container.html"){
<script>
    var all = 0;
</script>
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>运单修改</h5>
            </div>
        </div>
        <div class="layui-row" style="margin-bottom: 10px;">
            <div class="layui-col-sm1">
                <button class="layui-btn layui-btn-primary">基础信息</button>
            </div>
            <div class="layui-col-sm1" style="display: ${item.flow_status <=2?'none':'block'}">
                <button type="button" class="btn btn-primary button-margin" onclick="revokeOrder(${item.id})"
                        style="display: ${backStatus ==0?'none':'inline'}">
                    回收入库
                </button>
            </div>
            <div class="layui-col-sm1" style="display: ${item.flow_status ==0?'none':'block'}">
                <button type="button" class="btn btn-primary button-margin" onclick="addDelivery(${item.id})"
                        style="display: ${(item.Mode==0&&item.isTransfer=='0')?'inline':'none' }">
                    新增配送
                </button>
            </div>
            <div class="layui-col-sm1" style="display: ${item.flow_status >1?'none':'block'}">
                <button type="button" class="btn btn-primary button-margin" onclick="addDelivery(${item.id})"
                        style="display: ${(item.Mode==1&&item.isTransfer=='0')?'inline':'none' }">
                    新增配送
                </button>
            </div>
        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">单号：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="original_num" value="${item.original_num}" required lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input" readonly>
                    </div>
                </div>
            </div>

            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">交货方式：</label>
                    <div class="layui-input-inline">
                        <select name="mode" id="modeType" class="layui-select" onchange="showDiv(this.value)">
                            <option value="0">自提</option>
                            <option value="1">配送</option>
                            <option value="2">中转</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">状态：</label>
                    <input type="hidden" id="status" name="status" value="${item.status}">
                    <div class="layui-form-mid layui-word-aux">
                        @if(item.status==1){
                        待出库
                        @}else if(item.status==2){
                        已出库
                        @}else if(item.status==3){
                        完成
                        @}else{
                        待出库
                        @}
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">入库时间：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="date" id="inTime" value="${inTime}" readonly="readonly" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">入库时长：</label>
                    <div class="layui-form-mid layui-word-aux">${days}</div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">回单：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="receipt" id="receipt" value="${item.receipt}" required
                               lay-verify="required" placeholder="" autocomplete="off" onblur="orderBack()"
                               class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">回单状态：</label>
                    <select id="receiptStatus" name="receiptStatus" class="layui-select">
                        <option value="0" ${item.receiptStatus==0?'selected':''}>待回单</option>
                        <option value="1" ${item.receiptStatus==1?'selected':''}>已接收</option>
                        <option value="2" ${item.receiptStatus==2?'selected':''}>已完成</option>
                        <option value="3" ${item.receiptStatus==3?'selected':''}>无需回单</option>
                    </select>

                </div>
            </div>
        </div>

        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">收货人：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="consignee" value="${item.consignee}" name="password" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">收货电话：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="receivingPhone" value="${item.receivingPhone}" name="password" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm6">
                <div class="layui-form-item">
                    <label class="layui-form-label">地址：</label>
                    <div class="layui-input-inline" style="width: auto">
                        <select id="proPlaceName" class="layui-select">
                            @for(pro in regionList){
                            <option value="${pro.regionId}">${pro.regionName}</option>
                            @}
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width: auto">
                        <select id="cityPlaceName" class="layui-select">
                            @for(city in cityList){
                            <option value="${city.regionId}">${city.regionName}</option>
                            @}
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width: auto">
                        <select id="regPlaceName" class="layui-select">
                            @for(reg in regList){
                            <option value="${reg.regionId}">${reg.regionName}</option>
                            @}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" id="receivingAddress" value="${item.receivingAddress}" name="password"
                               required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space1">

        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">货物名称：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="goodsName" value="${item.goodsName}" name="password" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">重量：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="goodsWeight" value="${item.goodsWeight}" name="password" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">立方：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="goodsVolume" value="${item.goodsVolume}" name="password" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">件数：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="goodsPiece" value="${item.goodsPiece}" name="password" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">备注：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="mark" value="${item.mark}" name="password" required lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">配送方式：</label>
                    <div class="layui-input-inline">
                        <select id="modeFunc" class="layui-select" disabled="disabled">
                            <option value=""></option>
                            <option value="0">自提</option>
                            <option value="1">配送</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
            <div class="layui-form-item">
                <label class="layui-form-label">等通知发货：</label>
                <div class="layui-input-inline">
                    <select name="notice" id="notice" class="layui-select">
                        <option value="0"   ${notice=='0'?'selected':''}>否</option>
                        <option value="1" ${notice=='1'?'selected':''}>是</option>
                    </select>
                </div>
            </div>
            </div>
        </div>

        <div class="layui-row" style="margin-bottom: 10px;">
            <button class="layui-btn layui-btn-primary">收货信息</button>
        </div>

        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">车次号：</label>
                    <input type="text" name="batchNo" id="batchNo" value="${item.batchNo}" required style="width: 190px"
                           lay-verify="required" disabled placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">车次日期：</label>
                    <div class="layui-form-mid layui-word-aux">${ccTime}</div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">操作人：</label>
                    <div class="layui-input-inline">
                        <input type="hidden" id="isTransfer" value="${item.isTransfer}">
                        <input type="hidden" id="mode" name="mode" value="${item.mode}">
                        <input type="hidden" id="idS" value="${tTrain.id}">
                        <input type="hidden" id="id" value="${item.id}">
                        <input type="hidden" id="flow_status" value="${item.flow_status}">
                        <input type="hidden" id="processMethods" value="${orderBackRecordSend.processMethod}">
                        <input type="hidden" id="send_id" value="${orderBackRecordSend.id}">
                        <input type="hidden" id="receive_id" value="${orderBackRecordReceive.id}">
                        <input type="hidden" id="province_code" value="${item.province_code}">
                        <input type="hidden" id="city_code" value="${item.city_code}">
                        <input type="hidden" id="area_code" value="${item.area_code}">
                        <div class="layui-form-mid layui-word-aux">${createUser}</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">上游网点：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" id="sendDeptNameS" value="${item.sendDeptName}" required
                               lay-verify="required" disabled placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>司机：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" id="driverNameS" value="${tTrain.driverName}" required
                               lay-verify="required" disabled placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">司机电话：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" disabled id="phoneS" value="${tTrain.phone}" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">车牌号码：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" disabled id="carNoS" value="${tTrain.carNo}" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">提付(付)：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" onkeyup="Calculation()" value="${s_tf}" id="s_tf" required
                               lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">中转费(收)：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" onkeyup="Calculation()" value="${s_zz}" id="s_zz" required
                               lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">送货费(收)：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" onkeyup="Calculation()" value="${s_sh}" id="s_sh" required
                               lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">搬运费(收)：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" onkeyup="Calculation()" value="${s_by}" id="s_by" required
                               lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space1">
            <div class="layui-col-sm12">
                <div class="layui-form-item">
                    <label class="layui-form-label">代收货款(付)：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" onkeyup="Calculation()" value="${s_ds}" id="s_ds" required
                               lay-verify="required"
                               placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-row layui-col-space1" style="display: ${item.flow_status ==0?'none':'block'}">
            <div class="layui-col-sm4">
                <div class="layui-form-item">
                    <label class="layui-form-label" style="font-style: oblique;width: 140px;">修改新生成费用(￥)：</label>
                    <div class="layui-form-mid layui-word-aux"><span id="a1">0</span></div>
                </div>
            </div>
            <div class="layui-col-sm4">
                <div class="layui-form-item">
                    <label class="layui-form-label">费用处理：</label>
                    <div class="layui-input-block">
                        <input type="radio" class="layui-form-radio" name="isPay" value="0"> 现结
                        <input type="radio" class="layui-form-radio" name="isPay" value="1" checked="">月结
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row layui-col-space1" style="display: ${item.flow_status ==0?'none':'block'}">
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">现金：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="cashs" value="0" id="cashs" required lay-verify="required"
                               placeholder=""
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">微信：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="weixins" value="0" id="weixins" required lay-verify="required"
                               placeholder=""
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">支付宝：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="alipays" value="0" id="alipays" required lay-verify="required"
                               placeholder=""
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-col-sm3">
                <div class="layui-form-item">
                    <label class="layui-form-label">银行卡：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="banks" value="0" id="banks" required lay-verify="required"
                               placeholder=""
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div style="display: ${item.receiptStatus ==3?'none':'block'}">
            <div class="layui-row" style="margin-bottom: 10px;">
                <button class="layui-btn layui-btn-primary">回单信息</button>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">回单要求：</label>
                        <div class="layui-form-mid layui-word-aux">${item.receipt}</div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">回单状态：</label>
                        <div class="layui-form-mid layui-word-aux">
                            @if(item.receiptStatus==0){
                            待回单
                            @}else if(item.receiptStatus==1){
                            已接收
                            @}else if(item.receiptStatus==2){
                            已完成
                            @}else if(item.receiptStatus==3){
                            无需回单
                            @}
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">回单接收时间：</label>
                        <div class="layui-input-inline">
                            <input name="receive_time" id="receive_time" required lay-verify="required" placeholder=""
                                   autocomplete="off" value="${receive_time}" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">接收提供方：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="receiver" value="${orderBackRecordReceive.receiver}" id="receiver"
                                   value="" required lay-verify="required" placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">回单发送时间：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="send_Time" id="send_Time" required lay-verify="required"
                                   placeholder="" autocomplete="off" value="${send_time}" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">回单发送方：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sender" value="${orderBackRecordSend.sender}" id="sender" value=""
                                   required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>

                <!--  <div class="layui-col-sm3">
                      <div class="layui-form-item">
                          <label class="layui-form-label">操作人：</label>
                          <div class="layui-input-inline">
                              <div class="layui-form-mid layui-word-aux">/div>
                          </div>
                      </div>
                  </div>-->
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">备注：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="remark" name="remark" required lay-verify="required" placeholder=""
                                   value="${orderBackRecordSend.remark}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">处理方式：</label>
                        <div class="layui-input-inline">
                            <select id="processMethod" class="layui-select">
                                <option value="0">未回单</option>
                                <option value="1">邮寄</option>
                                <option value="2">司机带回</option>
                                <option value="3">其他</option>
                            </select>
                        </div>
                    </div>
                </div>
                <!-- <div class="layui-col-sm3">
                     <div class="layui-form-item">
                         <label class="layui-form-label">备注：</label>
                         <div class="layui-input-inline">
                             <input type="text" id="remark" name="remark" required lay-verify="required" placeholder=""
                                    value=""  autocomplete="off" class="layui-input">
                         </div>
                     </div>
                 </div>-->
            </div>


        </div>
        <div id="a">
            <div class="layui-row" style="margin-bottom: 10px;">
                <button class="layui-btn layui-btn-primary">自提出库信息</button>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">出库方式：</label>
                        <div class="layui-form-mid layui-word-aux">自提</div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">出库日期：</label>
                        <div class="layui-input-inline">
                            @if(item.status<=1){
                            <input type="text" name="date" value="" lay-verify="date"
                                   placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                            @}else{
                            <input type="text" name="date" id="creatTime" value="${inTime}" lay-verify="date"
                                   placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                            @}
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">

                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">操作人：</label>
                        <div class="layui-form-mid layui-word-aux">自提</div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">提付(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" id="z_tf" onkeyup="Calculation1()" value="${z_tf}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">代收货款(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" id="z_ds" onkeyup="Calculation1()" value="${z_ds}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">落地费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" id="z_ld" onkeyup="Calculation1()" value="${z_ld}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">仓储费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" id="z_cc" onkeyup="Calculation1()" value="${z_cc}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">搬运费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation1()" id="z_by" value="${z_by}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">提货人：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="reallyUser" id="reallyUser" value="${item.reallyUser}" required
                                   lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">联系电话：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="reallyPhone" id="reallyPhone" value="${item.reallyPhone}" required
                                   lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">身份证号：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="reallyCard" id="reallyCard" value="${item.reallyUser}" required
                                   lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1" style="display: ${item.flow_status <3?'none':'block'}">
                <div class="layui-col-sm4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="font-style: oblique;width: 140px;">修改新生成费用(￥)：</label>
                        <div class="layui-form-mid layui-word-aux"><span id="a2">0</span></div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1" style="display: ${item.flow_status <3?'none':'block'}">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">现金：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="cashz" value="0" id="cashz" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">微信：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="weixinz" value="0" id="weixinz" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付宝：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="alipayz" value="0" id="alipayz" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">银行卡：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="banksz" value="0" id="banksz" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="b">
            <div class="layui-row" style="margin-bottom: 10px;">
                <button class="layui-btn layui-btn-primary">配送出库信息</button>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">提付(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation2()" id="p_tf" value="${p_tf}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">代收货款(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation2()" id="p_ds" value="${p_ds}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">落地费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation2()" id="p_ld" value="${p_ld}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">仓储费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation2()" id="p_cc" value="${p_cc}"
                                   required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">搬运费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation2()" id="p_by" value="${p_by}"
                                   required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">送货费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation2()" id="p_sh" value="${p_sh}"
                                   required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">车费(付)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" name="password" id="p_cf" value="${p_cf}" required
                                   lay-verify="required" onkeyup="Calculation2()" placeholder="" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span></span>司机：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sendDeptNameP" id="sendDeptNameP" value="${tTrain1.driverName}"
                                   required lay-verify="required" disabled placeholder="" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">联系电话：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="phoneP" id="phoneP" value="${tTrain1.phone}" required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">车牌号码：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="carNoP" id="carNoP" value="${tTrain1.carNo}" required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">配送车次号：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="trainNoP" id="trainNoP" value="${tTrain1.trainNo}" required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1" style="display: ${item.flow_status <3?'none':'block'}">
                <div class="layui-col-sm4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="font-style: oblique;width: 140px;">修改新生成费用(￥)：</label>
                        <div class="layui-form-mid layui-word-aux"><span id="a3">0</span></div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1" style="display: ${item.flow_status <3?'none':'block'}">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">现金：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="cashp" value="0" name="cashp" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">微信：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="weixinp" value="0" name="weixinp" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付宝：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="alipayp" value="0" name="alipayp" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">银行卡：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="bankp" value="0" name="bankp" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="c">
            <div class="layui-row" style="margin-bottom: 10px;">
                <button class="layui-btn layui-btn-primary">中转出库信息</button>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">提付(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" value="${zz_f}" id="zz_f" required lay-verify="required"
                                   placeholder="" onkeyup="Calculation3()" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">代收货款(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="zz_ds" value="${zz_ds}" id="zz_ds" required lay-verify="required"
                                   placeholder="" onkeyup="Calculation3()" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">落地费(收)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" onkeyup="Calculation3()" id="zz_ld" value="${zz_ld}"
                                   required
                                   lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">中转费(付)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="zz_zz" onkeyup="Calculation3()" value="${zz_zz}" id="zz_zz"
                                   required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">搬运费(付)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="zz_by" onkeyup="Calculation3()" value="${zz_by}" id="zz_by"
                                   required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">送货费(付)：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="zz_sh" onkeyup="Calculation3()" value="${zz_sh}" id="zz_sh"
                                   required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">中转网点：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="transfer_name" id="transfer_name" value="${item.transfer_name}"
                                   required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">司机：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="driverNameZ" id="driverNameZ" value="${tTrain1.driverName}"
                                   required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">联系电话：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="phoneZ" id="phoneZ" value="${tTrain1.phone}" required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">车牌号码：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="carNoZ" id="carNoZ" value="${tTrain1.carNo}" required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">中转车次号：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="trainNoZ" id="trainNoZ" value="${tTrain1.trainNo}" required
                                   lay-verify="required" placeholder="" disabled autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1" style="display: ${item.flow_status <3?'none':'block'}">
                <div class="layui-col-sm4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="font-style: oblique;width: 140px;">修改新生成费用(￥)：</label>
                        <div class="layui-form-mid layui-word-aux"><span id="a4">0</span></div>
                    </div>
                </div>
                <div class="layui-col-sm4">
                    <div class="layui-form-item">
                        <label class="layui-form-label">费用处理：</label>
                        <div class="layui-input-block">
                            <input type="radio" class="layui-form-radio" name="isPayzz" value="0"> 现结
                            <input type="radio" class="layui-form-radio" name="isPayzz" value="1" checked="">月结
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space1" style="display: ${item.flow_status <3?'none':'block'}">
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">现金：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="cashzz" value="0" id="cashzz" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">微信：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="weixinzz" value="0" id="weixinzz" required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付宝：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="alipayzz" value="0" id="alipayzz" required lay-verify="required"
                                   placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <div class="layui-form-item">
                        <label class="layui-form-label">银行卡：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="bankzz" id="bankzz" value="0" required lay-verify="required"
                                   placeholder=""
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-horizontal" id="dotInfoForm">

            <div class="row">

            </div>
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="CloseWebPage()"/>
                    <#button btnCss="info" name="保存修改" id="ensure" icon="fa-check" clickFun="submitData()"/>
                </div>
            </div>
        </div>

    </div>
</div>
<style>
    table {
        table-layout: fixed;
        word-wrap: break-word;
    }

    .mtd td {
        height: 30px;
        border: #CCCCCC 1px solid;
        text-align: center
    }

    .layui-form-label {
        width: 100px;
        padding: 9px 0px;
    }

    .layui-form-item {
        margin-bottom: 1px;
    }

</style>

<script>
    var layerIndex = -1;



    var temA = 0;
    var temB = 0;
    var temC = 0;
    var temD = 0;
    $(function () {


//        if($('#send_id').val()==''){
//            $("#send_Time").attr('readonly','readonly');
//            $("#send_Time").removeAttr("onclick");
//            $("#sender").attr('readonly','readonly');
//            $("#processMethod").attr('readonly','readonly');
//            $("#remark").attr('readonly','readonly');
//
//        }
//        if($('#receive_id').val()==''){
//            $("#receive_time").attr('readonly','readonly');
//            $("#send_Time").removeAttr("onclick");
//            $("#receiver").attr('readonly','readonly');
//            $("#remark").attr('readonly','readonly');
//        }

        $('#proPlaceName').val($('#province_code').val());
        $('#processMethod').val($('#processMethods').val());
        $('#cityPlaceName').val($('#city_code').val());
        $('#regPlaceName').val($('#area_code').val());
        var isTransfer = $('#isTransfer').val();
        var mode = $('#mode').val();
        if (isTransfer == 1) {
            $('#a').hide();
            $('#b').hide();
            $('#c').show();
            $('#modeType').val(2);
            modeType_initial = 2;
            modeType_last = 2;
            $('#modeFunc').attr("disabled", false);//中转才能修改
            $('#modeFunc').val($('#mode').val());
        } else {
            if (mode == 0) {
                $('#c').hide();
                $('#b').hide();
                $('#a').show();
                $('#modeType').val(0);
                $('#modeFunc').val(0);
                modeType_initial = 0;
                modeType_last = 0;
            } else {
                $('#a').hide();
                $('#c').hide();
                $('#b').show();
                $('#modeType').val(1);
                $('#modeFunc').val(1);
                modeType_initial = 1;
                modeType_last = 1;
            }
        }

        if ($('#status').val() != 1) {
            $("#modeType").attr("disabled", true);
        }
        temA = parseFloat($('#s_tf').val()) * -1 + parseFloat($('#s_zz').val()) + parseFloat($('#s_sh').val()) + parseFloat($('#s_by').val()) + parseFloat($('#s_ds').val()) * -1;
        temB = parseFloat($('#z_tf').val()) + parseFloat($('#z_ds').val()) + parseFloat($('#z_ld').val()) + parseFloat($('#z_cc').val()) + parseFloat($('#z_by').val());
        temC = parseFloat($('#p_tf').val()) + parseFloat($('#p_ds').val()) + parseFloat($('#p_ld').val()) + parseFloat($('#p_cc').val()) + parseFloat($('#p_by').val()) + parseFloat($('#p_sh').val()) + parseFloat($('#p_cf').val()) * -1;
        temD = parseFloat($('#zz_f').val()) + parseFloat($('#zz_ds').val()) + parseFloat($('#zz_ld').val()) + parseFloat($('#zz_zz').val()) * -1 + parseFloat($('#zz_sh').val()) * -1 + parseFloat($('#zz_by').val()) * -1;

    })

    var lock=false;
    function submitData() {

        var sUrl = "";
        var mode = $('#mode').val();
        var isTransfer = $('#isTransfer').val();
        if (modeType_initial == modeType_last) {
            //初始化的状态与最终的订单状态相同，即没有改变订单类型
            if (modeType_initial == 2) {
                //中转单
                sUrl = Feng.ctxPath + "/tOrder/refOrderAndOrderFeeZZ";
            } else if (modeType_initial == 0) {
                //自提
                sUrl = Feng.ctxPath + "/tOrder/refOrderAndOrderFeeZT";
            } else {
                //配送
                sUrl = Feng.ctxPath + "/tOrder/refOrderAndOrderFeePS";
            }

        } else {
            //用户修改了订单类型
            sUrl = Feng.ctxPath + "/tOrder/changeOrderType";
        }

        if(!lock) {
            //防止多次点击
             lock = true; // 锁定
            window.setTimeout(function(){
                lock = false;
            },5000);
            var ajax = new $ax(sUrl, function (data) {

                Feng.success("修改成功!");
                location.reload();
            }, function (data) {
                Feng.error("修改失败!" + data.responseJSON.message + "!");
            });
            conntenData(ajax);
            if (flag) {
                ajax.start();
            }
        }

    }

    var flag = true;

    function conntenData(v) {

        flag = true;
        var modeType = $('#modeType').val();
        var a = parseFloat($('#a1').text());
        var asum = parseFloat($('#cashs').val()) + parseFloat($('#weixins').val()) + parseFloat($('#alipays').val()) + parseFloat($('#banks').val());
        if ($('input:radio[name=isPay]:checked').val() == 0) {
            if (a - asum != 0) {
                alert("收货金额不对");
                flag = false;
            }
        }

        if (modeType == 0) {
            var b = parseFloat($('#a2').text());
            var bsum = parseFloat($('#cashz').val()) + parseFloat($('#weixinz').val()) + parseFloat($('#alipayz').val()) + parseFloat($('#banksz').val());
            var flow_status = parseInt($('#flow_status').val());
            if (flow_status == 3 || flow_status == 4) {
                if (b - bsum != 0) {
                    alert("提付收货金额不对");
                    flag = false;
                }
            }

        } else if (modeType == 1) {
            var c = parseFloat($('#a3').text());
            var csum = parseFloat($('#cashp').val()) + parseFloat($('#weixinp').val()) + parseFloat($('#alipayp').val()) + parseFloat($('#bankp').val());

            var flow_status = parseInt($('#flow_status').val());
            if (flow_status == 3 || flow_status == 4) {
                if (c - csum != 0) {
                    alert("配送收货金额不对");
                    flag = false;
                }
            }

        } else {
            if ($('input:radio[name=isPayzz]:checked').val() == 0) {
                var d = parseFloat($('#a4').text());
                var dsum = parseFloat($('#cashzz').val()) + parseFloat($('#weixinzz').val()) + parseFloat($('#alipayzz').val()) + parseFloat($('#bankzz').val());

                var flow_status = parseInt($('#flow_status').val());
                if (flow_status == 3 || flow_status == 4) {
                    if (d - dsum != 0) {
                        alert("中转收货金额不对");
                        flag = false;
                    }
                }
            }
        }
        v.set("creatTime", $('#inTime').val());
        v.set("consignee");
        v.set("receivingPhone");
        v.set("province_code", $('#proPlaceName').val());
        v.set("city_code", $('#cityPlaceName').val());
        v.set("area_code", $('#regPlaceName').val());
        v.set("receivingAddress");
        v.set("goodsName");
        v.set("goodsWeight");
        v.set("goodsVolume");
        v.set("goodsPiece");
        v.set("mark");
        v.set("sendDeptNameS");
        v.set("driverNameS");
        v.set("phoneS");
        v.set("carNoS");
        v.set("s_tf");
        v.set("s_zz");
        v.set("s_sh");
        v.set("bacrRecord");
        v.set("s_by");
        v.set("s_ds");
        v.set("isPay", $('input:radio[name=isPay]:checked').val());
        v.set("cashs");
        v.set("weixins");
        v.set("alipays");
        v.set("banks");
        v.set("modeFunc");
        v.set("notice");
        //回单
        v.set("z_tf");
        v.set("id");
        v.set("z_ds");
        v.set("z_cc");
        v.set("z_by");
        v.set("reallyUser");
        v.set("reallyPhone");
        v.set("reallyCard");
        v.set("cashz");
        v.set("weixinz");
        v.set("alipayz");
        v.set("banksz");
        v.set("p_tf");
        v.set("p_ds");
        v.set("p_cc");
        v.set("p_by");
        v.set("p_sh");
        v.set("p_cf");
        v.set("sendDeptNameP");
        v.set("phoneP");
        v.set("carNoP");
        v.set("trainNoP");
        v.set("isPayp", "0");
        v.set("cashp");
        v.set("weixinp");
        v.set("alipayp");
        v.set("bankp");
        v.set("zz_f");
        v.set("zz_ds");
        v.set("zz_ds");
        v.set("zz_zz");
        v.set("zz_by");
        v.set("zz_sh");
        v.set("transfer_name");
        v.set("driverNameZ");
        v.set("phoneZ");
        v.set("a4", $('#a4').text());
        v.set("a1", $('#a1').text());
        v.set("carNoZ");
        v.set("batchNo");
        v.set("trainNoZ");
        v.set("isPayzz", $('input:radio[name=isPayzz]:checked').val());
        v.set("cashzz");
        v.set("weixinzz");
        v.set("alipayzz");
        v.set("bankzz");
        v.set("send_Time");
        v.set("sender");
        v.set("receiver");
        v.set("receive_time");
        v.set("receive_id");
        v.set("send_id");
        v.set("receipt");
        v.set("receiptStatus");
        v.set("processMethod");
        v.set("receiver");
        v.set("remark");
        v.set("modeType", $('#modeType').val());
        v.set("p_ld");
        v.set("z_ld");
        v.set("zz_ld");


    }

    function Calculation() {
        var a1 = parseFloat($('#s_tf').val()) * -1 + parseFloat($('#s_ds').val()) * -1 + parseFloat($('#s_zz').val()) + parseFloat($('#s_sh').val()) + parseFloat($('#s_by').val());

        $('#a1').text(a1 - temA);
    }

    function CloseWebPage() {
        if (navigator.userAgent.indexOf("MSIE") > 0) {
            if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
                window.opener = null;
                window.close();
            } else {
                window.open('', '_top');
                window.top.close();
            }
        }
        else if (navigator.userAgent.indexOf("Firefox") > 0) {
            window.location.href = 'about:blank ';
        } else {
            window.opener = null;
            window.open('', '_self', '');
            window.close();
        }
    }

    function Calculation1() {

        var a1 = parseFloat($('#z_tf').val()) + parseFloat($('#z_ds').val()) + parseFloat($('#z_cc').val()) + parseFloat($('#z_by').val()) + parseFloat($('#z_ld').val());

        $('#a2').text(a1 - temB);
    }

    function Calculation2() {

        var a1 = parseFloat($('#p_tf').val()) + parseFloat($('#p_ds').val()) + parseFloat($('#p_cc').val()) + parseFloat($('#p_by').val()) + parseFloat($('#p_sh').val()) + parseFloat($('#p_ld').val()) + parseFloat($('#p_cf').val()) * -1;

        $('#a3').text(a1 - temC);
    }

    function Calculation3() {

        var a1 = parseFloat($('#zz_f').val()) + parseFloat($('#zz_ds').val()) + parseFloat($('#zz_ld').val()) + parseFloat($('#zz_zz').val()) * -1 + parseFloat($('#zz_sh').val()) * -1 + parseFloat($('#zz_by').val()) * -1;

        $('#a4').text(a1 - temD);
    }

    var modeType_initial = null;//初始的配送状态
    var modeType_last = null;//上一次的配送状态
    function showDiv(v) {
        if (modeType_initial == 0) {
            //初始状态为自提
            if (v == 0) {//自提
                $('#c').hide();
                $('#b').hide();
                $('#a').show();
                modeType_last = 0;
            } else if (v == 1) {//配送
                Feng.confirm("自提改为配送?", function () {
                    $('#a').hide();
                    $('#c').hide();
                    $('#b').show();
                    //将自提的费用带入配送的input
                    $('#p_tf').val($('#z_tf').val());
                    $('#p_ds').val($('#z_ds').val());
                    $('#p_cc').val($('#z_cc').val());
                    $('#p_by').val($('#z_by').val());
                    $('#p_ld').val($('#z_ld').val());
                    modeType_last = 1;
                }, function () {
                    $('#modeType').val(modeType_last);
                });
            } else {//中转
                Feng.confirm("自提改为中转？自提的仓储费，搬运费将被清空", function () {
                    $('#a').hide();
                    $('#b').hide();
                    $('#c').show();
                    $('#zz_f').val($('#z_tf').val());
                    $('#zz_ds').val($('#z_ds').val());
                    $('#zz_ld').val($('#z_ld').val());
                    modeType_last = 2;
                }, function () {
                    $('#modeType').val(modeType_last);
                })
            }

        } else if (modeType_initial == 1) {
            //初始状态为配送
            if (v == 0) {
                Feng.confirm("配送改为自提?配送的车费，送货费将被清空", function () {
                    $('#c').hide();
                    $('#b').hide();
                    $('#a').show();
                    //将自提的费用带入配送的input
                    $('#z_tf').val($('#p_tf').val());
                    $('#z_ds').val($('#p_ds').val());
                    $('#z_cc').val($('#p_cc').val());
                    $('#z_by').val($('#p_by').val());
                    $('#z_ld').val($('#p_ld').val());
                    modeType_last = 0;
                }, function () {
                    $('#modeType').val(modeType_last);
                });
            } else if (v == 1) {//配送
                $('#a').hide();
                $('#c').hide();
                $('#b').show();
                modeType_last = 1;
            } else {//中转

                Feng.confirm("配送改为中转?配送的车费，送货费,搬运费，仓储费将被清空", function () {
                    $('#a').hide();
                    $('#b').hide();
                    $('#c').show();
                    //将自提的费用带入配送的input
                    $('#zz_f').val($('#p_tf').val());
                    $('#zz_ds').val($('#p_ds').val());
                    $('#zz_ld').val($('#p_ld').val());
                    modeType_last = 2;
                }, function () {
                    $('#modeType').val(modeType_last);
                });
            }
        } else if (modeType_initial == 2) {
            //初始状态为中转
            if (v == 0) {//自提
                Feng.confirm("中转改为自提?中转的送货费,搬运费,中转费将被清空", function () {
                    $('#c').hide();
                    $('#b').hide();
                    $('#a').show();
                    $('#z_tf').val($('#zz_f').val());
                    $('#z_ds').val($('#zz_ds').val());
                    $('#z_ld').val($('#zz_ld').val());
                    modeType_last = 0;
                }, function () {
                    $('#modeType').val(modeType_last);
                });

            } else if (v == 1) {//配送
                Feng.confirm("中转改为配送?中转的送货费,搬运费,中转费将被清空", function () {
                    $('#a').hide();
                    $('#c').hide();
                    $('#b').show();
                    $('#p_tf').val($('#zz_f').val());
                    $('#p_ds').val($('#zz_ds').val());
                    $('#p_ld').val($('#zz_ld').val());
                    modeType_last = 1;
                }, function () {
                    $('#modeType').val(modeType_last);
                });
            } else {//中转
                $('#a').hide();
                $('#b').hide();
                $('#c').show();
                modeType_last = 2;
            }
        }
    }

    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        //日期
//        laydate.render({
//            elem: '#inTime'
//        });
        laydate.render({
            elem: '#send_Time'
        });
        laydate.render({
            elem: '#receive_time'
        });
    })


    $("#proPlaceName").change(function () {
        if ($("#proPlaceName").val() != '') {
            $.ajax({
                type: 'POST',
                url: Feng.ctxPath + '/region/getRegionById.do?id=' + $('#proPlaceName').val(),
                success: function (data) {
                    data = eval(data);
                    if (data != null && data.length > 0) {
                        var html = "";
                        for (var i = 0; i < data.length; i++) {
                            html += "<option value='" + data[i].regionId + "'>" + data[i].regionName + "</option>";
                        }
                    }
                    $("#cityPlaceName").html(html);
                    $("#regPlaceName").val('');
                },
                failure: function () {

                }
            });
        }
    });

    $("#cityPlaceName").change(function () {
        if ($("#cityPlaceName").val() != '') {
            $.ajax({
                type: 'POST',
                url: Feng.ctxPath + '/region/getRegionById.do?id=' + $('#cityPlaceName').val(),
                success: function (data) {
                    data = eval(data);
                    if (data != null && data.length > 0) {
                        var html = "";
                        for (var i = 0; i < data.length; i++) {
                            html += "<option value='" + data[i].regionId + "'>" + data[i].regionName + "</option>";
                        }
                    }
                    $("#regPlaceName").html(html);
                },
                failure: function () {

                }
            });
        }
    });

    function revokeOrder(order_id) {
        Feng.confirm("该订单将重新回到库存，请将收取的费用退还客户", function () {
            //提交信息
            var ajax = new $ax(Feng.ctxPath + "/tOrder/revokeOrder?id=" + order_id, function (data) {
                Feng.success("回收成功!");
                location.reload();
            }, function (data) {
                Feng.error("回收失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        }, function () {

        });
    }

    //新增配送
    function addDelivery(id) {
        var index = layer.open({
            type: 2,
            shade: 0.01,
            title: '新增配送',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tOrder/addSubDeliveryPage?id=' + id
        });
        this.layerIndex = index;
    }

    function orderBack() {
        if ($('#receipt').val() != '' && $('#receiptStatus').val() == 3) {
            $('#receiptStatus').val(0);
        }
    }

</script>
@}
